home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
editor
/
wf314.zip
/
WF311DOC.ZIP
/
DOCS
/
WF.011
< prev
next >
Wrap
Text File
|
1992-01-31
|
7KB
|
197 lines
.f3 - # - Chapter 11 - Calculator
.rm70
.tc
.tc1
.tc 11. CALCULATOR ........................................#
CHAPTER 11 CALCULATOR
.imCalculator (Alt =)
Word Fugue has a built in calculator that you can use while you are
editing. All the usual mathematical operations are available -
addition, subtraction, division, multiplication, and exponentiation.
Additional functions are natural and common logarithms, square root,
factorial, and the trigonometric functions sine, cosine, tangent and
arctangent.
Several symbols (operators) are used in Word Fugue's Mathematical
equations.
.ix Operators in equations
Operator Function
+ addition
- subtraction
^ exponentiation (raising a number to a power)
* multiplication
/ division
div integer division
mod integer division giving remainder only
shl shift the bit pattern (4 byte integer) left
same as multiplying by 2:
4 shl 2 = 16 same as 4 * 2 * 2
shr shift the bit pattern (4 byte integer) right
same as dividing by 2:
16 shr 2 = 4 same as 16 / 2 / 2
and merge 2 bit patterns:
1 and 1 => 1
1 and 0 => 0
0 and 1 => 0
0 and 0 => 0
or merge 2 bit patterns:
1 or 1 => 1
1 or 0 => 1
0 or 1 => 1
0 or 0 => 0
xor merge 2 bit patterns:
1 xor 1 => 0
1 xor 0 => 1
0 xor 1 => 1
0 xor 0 => 0
.ix Functions
SQRT() square root
SQR() square
SIN() sine
COS() cosine
TAN() tangent
ATN() arctangent
LN() natural log
LOG() log base 10
FACT() factorial
EXP() e raised to the power x
PI the value of PI
TRUE the value 1 or boolean true
FALSE the value 0 or boolean false
.CP5
The circle functions (SIN COS TAN ATN) all work in radians, not
degrees, so that SIN(PI) = 0, but SIN(90) = 0.893996663600558
You can use these operators in any order in any combination for almost
any calculation. Equations are limited in length to the width of the
screen. Each function can have an arbitrarily complicated equation
within its brackets.
For example
SQRT(SQR(34.5))
LOG(FACT(5)+SIN(21)*LN(1.02345296368))
.ix Scientific notation
You can use scientific notation to enter a long number. For example
1.23e15 represents the number 1230000000000000.000. Answers have a
maximum precision of 19 digits. If the answer is longer, Word Fugue
will give the closest answer it can, using 20 digits. The largest
number you can work with is 1.1E+4932, and the smallest is 3.4E-4932.
Overflow will cause erroneous results to display. (Word Fugue uses 20
digit reals internally)
.ix Order of Precedence
Where there is more than one operator on a line, Word Fugue performs
the operations in a specific order - exponentiation, then
multiplication, division, then addition and subtraction. When
operators are of equal precedence, Word Fugue performs the operations
from left to right.
.CP5
.ix Parentheses
You can change the order in which Word Fugue performs operations by
using parentheses to enclose operations that are to be done first. You
can enclose parentheses within parentheses for more complicated
calculations. Word Fugue always performs the operations within the
innermost set of parentheses first.
For example:
2^3+4-5/6*7 (answer 6.16666667)
2^(3+4-5)/6*7 (answer 4.66666667)
2^((3+4-5)/6*7) (answer 5.03968420)
.ix Boolean equations
You can also enter boolean equations for evaluation, using the
functions TRUE and FALSE. The boolean operators supported are
AND
OR
XOR
NOT
and you can put boolean equations in brackets. The result will be 1
for True and 0 for False. If you use other numbers, their binary bit
pattern will be combined according to the rules of boolean algebra.
.CP11
For example
true xor false (answer 1.0 boolean)
1 xor 3 (answer 2.0 numeric)
1 = 01 binary
3 = 11 binary
X = 10 binary => 2 numeric
10 / 3 (answer 3.333333333333333)
10 div 3 (answer 3 (integer quotient))
10 mod 3 (answer 1 (the remainder) )
5 shl 1 (answer 10)
5 shr 1 (answer 2)
NOTE - When you use operators that are letters, you must separate them
from the values they operate on by spaces. Thus
10 mod 3 is right but 10mod3 is wrong.
.cp8
.tc Using The Pop Up Calculator ........................#
Using The Pop Up Calculator
1. Press Alt = or Ctrl J M to display the calculator window.
Refer to Fig 11.1 below.
2. Type an equation.
3. Press Enter
You will see the result appear in the next line
4. Press ESC to return to editing, or press Enter to type in a new
equation. If you press an editing key first, you can edit the
existing equation.
╔══════════════════ Calculator: Enter Formula to calculate: ════════════╗
║ 16 shr 2 ║
║ ║
║ ║
║ ABS,SQRT,SQR,SIN,COS,ATN,LN,LOG,EXP,TAN,FACT,^,*,/,+,- ║
║ ║
╚═══════════════════════════════════════════════════════════════════════╝
Fig 11.1 - Pop Up Calculator
.tc1 Fig 11.1 - Pop Up Calculator ..........................#
.tc Copying the Last Result Into the Document ..........#
.ix Pasting last result
Copying the Last Result Into the Document
To copy the last result into the document you are editing press
Alt O =
or Ctrl J I =
or Alt M A (macro)
The result will appear where the cursor is positioned.
Note the next time you use the calculator in the same editing session,
you will find the last equation displayed ready for you to re-enter or
edit.
.CP5
.tc Copying the Equation into the Document .............#
.ix Pasting equation
Copying the Equation into the Document
To copy the actual equation used into the document you are editing,
type in
Alt O #
or Ctrl J I #
or Alt M E (macro)
The equation will appear at the cursor position.